package com.corpgovernment.supplier.vo.suppliercompany;

import com.corpgovernment.supplier.entity.db.SupplierCompanyContract;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;

/**
 * @author jhxue
 */
@Data
@ApiModel("供应商合同实体类")
public class SupplierCompanyContractVo {
    /**
     * 主键
     */
    private Long id;
    /**
     * 供应商公司关系主键
     */
    private Long supplierCompanyId;
    /**
     * 合同编号/名称
     */
    private String contractNo;
    /**
     * 签署人
     */
    private String signPerson;
    /**
     * 联系方式
     */
    private String phone;
    /**
     * 合同开始日期(yyyy/MM/dd)
     */
    @NotBlank(message = "合同开始时间不能为空")
    private String startDate;
    /**
     * 合同结束日期(yyyy/MM/dd)
     */
    @NotBlank(message = "合同结束时间不能为空")
    private String endDate;
    /**
     * 合同名称
     */
    private String fileName;
    /**
     * 合同url
     */
    private String contractUrl;

    public static SupplierCompanyContract toSupplierCompanyContact(SupplierCompanyContractVo vo) {
        SupplierCompanyContract entity = new SupplierCompanyContract();
        BeanUtils.copyProperties(vo, entity);
        return entity;
    }

    public static SupplierCompanyContractVo toSupplierCompanyContactVo(SupplierCompanyContract entity) {
        SupplierCompanyContractVo vo = new SupplierCompanyContractVo();
        BeanUtils.copyProperties(entity, vo);
        return vo;
    }
}